39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define SMARTBUCK8_REG_VOUT 0x01
74#define SMARTBUCK8_REG_CONTROL 0x03
75#define SMARTBUCK8_REG_STATUS 0x05
93#define SMARTBUCK8_CONTROL_RESET 0x80
94#define SMARTBUCK8_CONTROL_EN_FPWM_ON_CHANGE 0x40
95#define SMARTBUCK8_CONTROL_SOFT_EN 0x20
96#define SMARTBUCK8_CONTROL_EN_FPWM 0x10
97#define SMARTBUCK8_CONTROL_EN_OUT_DISCHARGE 0x08
98#define SMARTBUCK8_CONTROL_EN_HICCUP 0x04
99#define SMARTBUCK8_CONTROL_V_RAMP_SPEED_0_25US 0x00
100#define SMARTBUCK8_CONTROL_V_RAMP_SPEED_0_5US 0x01
101#define SMARTBUCK8_CONTROL_V_RAMP_SPEED_1US 0x02
102#define SMARTBUCK8_CONTROL_V_RAMP_SPEED_5US 0x03
103#define SMARTBUCK8_CONTROL_V_RAMP_SPEED_MASK 0x03
109#define SMARTBUCK8_STATUS_THERMAL_WARNING 0x10
110#define SMARTBUCK8_STATUS_HICCUP 0x08
111#define SMARTBUCK8_STATUS_UVLO 0x01
117#define SMARTBUCK8_VOUT_MV_MIN 400
118#define SMARTBUCK8_VOUT_MV_MAX 1675
119#define SMARTBUCK8_VOUT_MV_STEP_5MV 5
126#define SMARTBUCK8_DEVICE_ADDRESS 0x42
144#define SMARTBUCK8_MAP_MIKROBUS( cfg, mikrobus ) \
145 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
146 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
147 cfg.pon = MIKROBUS( mikrobus, MIKROBUS_RST ); \
148 cfg.en = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
149 cfg.pg = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t smartbuck8_write_reg(smartbuck8_t *ctx, uint8_t reg, uint8_t data_in)
Smart Buck 8 write register function.
void smartbuck8_disable_power(smartbuck8_t *ctx)
Smart Buck 8 disable power function.
err_t smartbuck8_set_control(smartbuck8_t *ctx, uint8_t control)
Smart Buck 8 set control register function.
void smartbuck8_cfg_setup(smartbuck8_cfg_t *cfg)
Smart Buck 8 configuration object setup function.
void smartbuck8_enable_power(smartbuck8_t *ctx)
Smart Buck 8 enable power function.
void smartbuck8_enable_device(smartbuck8_t *ctx)
Smart Buck 8 enable device function.
err_t smartbuck8_default_cfg(smartbuck8_t *ctx)
Smart Buck 8 default configuration function.
err_t smartbuck8_init(smartbuck8_t *ctx, smartbuck8_cfg_t *cfg)
Smart Buck 8 initialization function.
err_t smartbuck8_read_status(smartbuck8_t *ctx, uint8_t *status)
Smart Buck 8 read status register function.
void smartbuck8_disable_device(smartbuck8_t *ctx)
Smart Buck 8 disable device function.
err_t smartbuck8_set_vout(smartbuck8_t *ctx, uint16_t vout_mv)
Smart Buck 8 set output voltage function.
uint8_t smartbuck8_get_pg_pin(smartbuck8_t *ctx)
Smart Buck 8 get power-good pin function.
err_t smartbuck8_read_reg(smartbuck8_t *ctx, uint8_t reg, uint8_t *data_out)
Smart Buck 8 read register function.
smartbuck8_return_value_t
Smart Buck 8 Click return value data.
Definition smartbuck8.h:198
@ SMARTBUCK8_ERROR
Definition smartbuck8.h:200
@ SMARTBUCK8_OK
Definition smartbuck8.h:199
Smart Buck 8 Click configuration object.
Definition smartbuck8.h:180
uint32_t i2c_speed
Definition smartbuck8.h:188
pin_name_t pon
Definition smartbuck8.h:184
pin_name_t scl
Definition smartbuck8.h:181
pin_name_t en
Definition smartbuck8.h:185
pin_name_t sda
Definition smartbuck8.h:182
pin_name_t pg
Definition smartbuck8.h:186
uint8_t i2c_address
Definition smartbuck8.h:189
Smart Buck 8 Click context object.
Definition smartbuck8.h:159
digital_out_t pon
Definition smartbuck8.h:161
i2c_master_t i2c
Definition smartbuck8.h:168
digital_out_t en
Definition smartbuck8.h:162
uint8_t slave_address
Definition smartbuck8.h:171
digital_in_t pg
Definition smartbuck8.h:165